<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    String date = format.format(new Date());
%>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/StudentsListPageAsEnrol.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
</head>
<style>
    select {
        width: 234px;
        height: 31px
    }

    .gn_name {
        padding-top: 5px
    }

    .div_zilei {
        width: 600px;
        padding-left: 90px;
        height: 30px
    }

    .tr {
        height: 40px;
        background: #a9bbe0
    }

    .tr td {
        font-size: 14px;
        color: #ffffff
    }

    .tr_td {
        height: 40px;
    }

    .tr_td td {
        border-bottom: 1px solid #ededed;
        text-align: center;
    }

    tr td:nth-child(1) {
        font-size: 14px;
        color: #cccccc
    }

    .date {
        border: 0;
        background: #ffffff;
        text-align: center;
    }

    .tr_td td:nth-child(1) {
        border-left: 1px solid #cccccc;
    }

    .deleteTable:HOVER {
        cursor: pointer;
        color: #056dae;
    }

    .addTable:HOVER {
        cursor: pointer;
        color: #056dae;
    }

    input {
        height: 31px
    }

    .div_input_hang {
        width: 97%
    }

    .input_hang {
        width: 30%;
        height: 60px
    }

    .input_hang input {
        width: 200px
    }

    .gn_name {
        width: 100px
    }

    .order {
        margin-right: 20px;
        font-size: 16px;
        cursor: pointer;
    }

    .order.ACTIVE {
        margin-right: 20px;
        color: #a9bbe0;
        font-size: 16px;
        border-bottom: 3px solid #427dff;
        cursor: pointer;
    }

    .tablelist tr td {
        text-align: center;
    }

    .tr_td td input {
        border: none;
    }

    .modal-data-error {
        visibility: hidden;
        z-index: 1001;
        min-height: 300px;
        margin: 100px auto;
        background-color: #FFFFFF;
        /* border: 1px solid #C80B14;*/
        -moz-box-shadow: 0 10px 20px #8AC1E2 inset, 0 -10px 0 #57a0ff inset;
        -webkit-box-shadow: 0 10px 20px #8AC1E2 inset, 0 -10px 0 #57a0ff inset;
        /*         box-shadow:0 0 10px #cccccc;
        box-shadow: #cccccc; */
        box-shadow: 0 10px 20px #57a1ff inset, 0 -10px 0 #57a0ff inset;
        padding: 5px;
        text-align: center;
        position: fixed;
        left: 22%;
    }

    #table-error {

    }

    .shuju td {
        border: 1px solid #dddee6;
        color: #787c88;
        text-align: center;
    }

    .shuju:nth-child(odd) {
        background: #ffffff
    }

    .shuju:nth-child(even) {
        background: #f3f5fb
    }

    .shuju:last-child {
        border-bottom: 1px solid #dddee6;
    }

    .shuju:HOVER {
        background: #fff6cd;
    }

    .error-list {
        margin-top: 40px;
        margin-left: 50px;
    }

    .error-head {
        text-align: center;
        margin-top: 30px;
        font-size: 16px;
        font-weight: bold;
    }

    .shuju td:first-child {
        width: 10px;
    }

</style>
<body style="background: #f5f5f5">
<div class="main">
    <div class="weizhi">
        预约管理>>练车预约(批量)>>查看
    </div>
    <div class="modal-data-error">
        <div style="width:600px; height:450px;">
            <div class="error-head">导入失败名单</div>
            <div id="error" style="height: 350px; overflow:auto;">

            </div>

        </div>
        <button class="btn" style="width: 150px;position: absolute;bottom: 35px;font-size: 16px;right: 250px">
            关闭
        </button>

    </div>

    <div class="div_body" style="min-height: 900px">
        <%--提示的隐藏标识--%>
        <input type="hidden" id="alertType" value="${alertType}">

        <div class="div_form">
            <div class="div_input_hang">
                <div>
                    <input style="width: 90px;height: 30px;margin-top: 0px" id="exportExcle" class="input_submit"
                           value="导出EXCLE" type="submit">
                </div>
                <div>
                    <input style="width: 90px;height: 30px;margin-top: 0px" id="uploadEventBtn" class="input_submit"
                           value="导入EXCLE" type="submit">
                </div>
                <form id="batchUpload" method="post" class="form-horizontal" enctype="multipart/form-data">
                    <!-- <button class="btn btn-success btn-xs" id="uploadEventBtn" style="height:26px;"  type="button" >选择文件</button> -->
                    <input type="file" name="file" style="width:0px;height:0px;" id="uploadEventFile">
                    <input type="hidden" id="uploadEventPath" disabled="disabled" placeholder="请选择excel表"
                           style="border: 1px solid #e6e6e6; height: 26px;width: 200px;">
                </form>
            </div>
            <!--新增  -->
            <form action="<%=path%>/DrivingSys/add_practiseOrder" class="form" id="update_shar" method="post"
                  onsubmit="StopRepeat2()">

                <div class="div_input_hang">
                    <div class="input_hang">
                        <span class="gn_name">练车班次&nbsp;:&nbsp;</span>
                        <input name="cfexamdate" id="date" readonly="readonly" value="${sharecarsubView.cfdycs}"
                               style="color: gray;"/>
                        <input type="hidden" value="${sharecarsubView.cflcsjid}" name="cflcsjid">
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">预约类型&nbsp;:&nbsp;</span>
                        <select disabled="disabled" style="width:200px;height: 32px" class="cfbilltype">
                            <c:if test="${sharecarsubView.cfbilltype eq 2}">
                                <option value="2" style="font-size: 16px">科目二</option>
                            </c:if>
                            <c:if test="${sharecarsubView.cfbilltype eq 3}">
                                <option value="3" style="font-size: 16px">科目三</option>
                            </c:if>
                        </select>
                        <input type="hidden" name="cfsubject" id="cfsubject" value="${sharecarsubView.cfbilltype}">
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">车型&nbsp;:&nbsp;</span>
                        <select disabled="disabled" class="carType" name="carType"style="width: 200px">
                            <option value="${sharecarsubView.cfsqzjcxdh}"
                                    style="font-size: 16px">${sharecarsubView.cfsqzjcxdh}</option>
                        </select>
                        <input type="hidden" name="cfcarbyte" value="${sharecarsubView.cfsqzjcxdh}">
                    </div>

                </div>
                <div class="div_input_hang">
                    <div class="input_hang">
                        <span class="gn_name">班次人数&nbsp;:&nbsp;</span>
                        <input value="${sharecarsubView.cfqty}" class="yyCount" disabled="disabled" type="text"
                               style="color: gray;"/>

                    </div>
                    <div class="input_hang">
                        <span class="gn_name">预约成功人数&nbsp;:&nbsp;</span>
                        <input class="yyCount" disabled="disabled" type="text" style="color: gray;"
                               value="${sharecarsubView.yysize}"/>

                    </div>
                    <div class="input_hang">
                        <span class="gn_name">其中初考人数&nbsp;:&nbsp;</span>
                        <input class="ckCount" disabled="disabled" type="text" style="color: gray;"
                               value="${sharecarsubView.cksize}"/>
                    </div>
                </div>
                <div class="div_input_hang">
                    <div class="input_hang">
                        <span class="gn_name">补考人数&nbsp;:&nbsp;</span>
                        <input class="bkCount" disabled="disabled" type="text" style="color: gray;"
                               value="${sharecarsubView.bksize}"/>
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">退练人数&nbsp;:&nbsp;</span>
                        <input class="bkCount" disabled="disabled" type="text" style="color: gray;"
                               value="${sharecarsubView.tlsize}"/>
                    </div>
                </div>


                <div class="div_zilei" style="width: 78%;float: left;padding-left: 20px">
                    <div style="width: 200px;text-align: left;float: left;color: #444444;font-size: 16px;">
                        <span class="order active">预约成功</span>
                        <span class="order">预约失败</span>
                    </div>
                    <div style="text-align: right;float: right;line-height: 30px">
                        <img src="<%=path%>/image/insert2323.jpg" class="addTable">
                        <span style="padding-right: 30px;color: #a9bbe0;font-size: 14px;cursor: pointer;"
                              onclick='clickName($(this),1)'>添加预约成功学员</span>

                        <img src="<%=path%>/image/insert2323.jpg" class="addTable">
                        <span style="padding-right: 10px;color: #a9bbe0;font-size: 14px;cursor: pointer;"
                              onclick='clickName($(this),2)'
                              class="failTable">添加预约失败学员</span>
                        <input class="flag" id="flag" type="hidden" value="1">
                        <img src="<%=path%>/image/delete212.png" class="deleteTable">
                        <span class="deleteTable" style="color: #a9bbe0;font-size: 14px" class="deleteTable">删除</span>
                    </div>
                </div>
                <div class="success">
                    <div style="overflow:auto;height: 370px;width: 80%;padding-left: 20px;padding-top: 20px;">
                        <table width="100%" align="center" class="tablelist" id="succesStudnet"
                               style="min-height:30px;overflow:hidden;border-spacing:0;">
                            <tr class="tr">
                                <td width="20px"></td>
                                <td width="200px" align="center">学员编码</td>
                                <td width="200px" align="center">学员名称</td>
                                <td width="200px" align="center">性别</td>
                                <td width="200px" align="center">班级</td>
                                <td width="200px" align="center">车型</td>
                                <td width="200px" align="center">身份证号码</td>
                                <td width="200px" align="center">手机</td>
                                <td width="200px" align="center">应收金额</td>
                                <td width="200px" align="center">已收金额</td>
                                <td width="200px" align="center">优惠金额</td>
                                <td width="200px" align="center">欠费金额</td>
                                <td width="200px" align="center">初考/补考</td>
                                <td width="200px" align="center">教练</td>
                                <td width="200px" align="center">要求同车</td>
                                <td width="200px" align="center">退练次数</td>
                                <td width="200px" align="center">科目二考试时间</td>
                                <td width="200px" align="center">科目三不及格时间</td>
                                <td width="200px" align="center">备注</td>
                            </tr>
                            <c:forEach items="${sharecarsubList}" var="sharecarsubList" varStatus="s">
                                <tr class="tr_td">
                                    <td><input class='check2' type='checkbox' name='check2'
                                               style='width:15px'><input name="check" type="hidden"
                                                                    value="${sharecarsubList.fid}">
                                    </td>
                                    <td><input style="width: 110px;" value="${sharecarsubList.xsfnumber}"
                                               readonly="readonly"></td>
                                    <td>
                                        <input style="width: 60px;" name="cfstudentname"
                                               value="${sharecarsubList.cfstudentname}" readonly="readonly">
                                        <input type="hidden" name="cfstudentid"
                                               value="${sharecarsubList.cfstudentid}">
                                    </td>
                                    <c:if test="${sharecarsubList.cfsex == 1}">
                                        <td><input style="width: 40px; text-align: center" readonly="readonly"
                                                   value="男"></td>
                                    </c:if>
                                    <c:if test="${sharecarsubList.cfsex == 2}">
                                        <td><input style="width: 40px; text-align: center" readonly="readonly"
                                                   value="女"></td>
                                    </c:if>
                                    <td><input style="width: 110px;" name="" value="${sharecarsubList.classname}"
                                               readonly="readonly">
                                        <input type="hidden" name="cfclazzid" value="${sharecarsubList.cfclazzid}"
                                               readonly="readonly">
                                    </td>
                                    <td><input style="width: 60px; text-align: center" name="cfsqzjcxdh"
                                               value="${sharecarsubList.cfsqzjcxdh}" readonly="readonly"></td>
                                    <input type="hidden" name="cfsqzjcxdh" value="${sharecarsubList.cfsqzjcxdh}">
                                    <td><input style="width: 160px; text-align: center" name="cfidcardno"
                                               value="${sharecarsubList.cfidcardno}" readonly="readonly"></td>
                                    <td><input style="width: 100px; text-align: center" name="cfmobile"
                                               value="${sharecarsubList.cfmobile}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cfamount"
                                               value="${sharecarsubList.cfamount}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cfreceived"
                                               value="${sharecarsubList.cfreceived}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cffavorable"
                                               value="${sharecarsubList.cffavorable}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cfarrearage"
                                               value="${sharecarsubList.cfarrearage}" readonly="readonly"></td>
                                    <c:if test="${sharecarsubList.cfkscs eq 0}">
                                        <td><input style="width: 80px; text-align: center" value="初考"
                                                   readonly="readonly"></td>
                                    </c:if>
                                    <c:if test="${sharecarsubList.cfkscs > 0}">
                                        <td><input style="width: 80px; text-align: center" value="补考"
                                                   readonly="readonly"></td>
                                    </c:if>
                                    <c:if test="${sharecarsubList.cfkscs eq null}">
                                        <td><input style="width: 80px; text-align: center" value="初考"
                                                   readonly="readonly"></td>
                                    </c:if>
                                    <input type="hidden" value="${sharecarsubList.cfkscs}" name="cfkscs">
                                    <td><input style="width: 70px; text-align: center" name=""
                                               value="${sharecarsubList.cfcoachname}" readonly="readonly"></td>
                                    <td><input style="width: 80px; text-align: center" value="无" readonly="readonly">
                                    </td>
                                    <td><input style="width: 70px; text-align: center" name=""
                                               value="${sharecarsubList.tlcs}" readonly="readonly"></td>
                                    <td><input style="width: 90px; text-align: center" name="cfkmekssj"
                                               value="${sharecarsubList.cfkmekssj}" readonly="readonly"></td>
                                    <td><input style="width: 90px; text-align: center" name="cfkmsbjksj"
                                               value="${sharecarsubList.cfkmsbjksj}" readonly="readonly"></td>
                                    <td><input style="width: 160px; text-align: center" name="cfremark"
                                               value="${sharecarsubList.cfremark}"><input
                                            type="hidden" name="states" value="1"></td>
                                    <input type="hidden" name="cfcoachname" value="">
                                    <input type="hidden" name="cfcoachid" value="">
                                </tr>
                            </c:forEach>
                        </table>
                    </div>
                </div>


                <div class="fail" style="display: none;">
                    <div style="overflow:auto;height: 240px;width: 79%;padding-left: 20px;padding-top: 20px;">
                        <table width="100%" align="center" class="table1"
                               style="min-height:30px;overflow:hidden;border-spacing:0;">
                            <tr class="tr">
                                <td width="20px"></td>
                                <td width="200px" align="center">学员编码</td>
                                <td width="200px" align="center">学员名称</td>
                                <td width="200px" align="center">性别</td>
                                <td width="200px" align="center">班级</td>
                                <td width="200px" align="center">车型</td>
                                <td width="200px" align="center">身份证号码</td>
                                <td width="200px" align="center">手机</td>
                                <td width="200px" align="center">应收金额</td>
                                <td width="200px" align="center">已收金额</td>
                                <td width="200px" align="center">优惠金额</td>
                                <td width="200px" align="center">欠费金额</td>
                                <td width="200px" align="center">初考/补考</td>
                                <td width="200px" align="center">教练</td>
                                <td width="200px" align="center">要求同车</td>
                                <td width="200px" align="center">退练次数</td>
                                <td width="200px" align="center">科目二考试时间</td>
                                <td width="200px" align="center">科目三不及格时间</td>
                                <td width="200px" align="center">备注</td>
                            </tr>
                            <c:forEach items="${sharecarsubList2}" var="sharecarsubList" varStatus="s">
                                <tr class="tr_td">
                                    <td><input class='check2' type='checkbox' name='check2'
                                               style='width:15px'><input name="check" type="hidden"
                                                                    value="${sharecarsubList.fid}">
                                    </td>
                                    <td><input style="width: 110px;" value="${sharecarsubList.xsfnumber}"
                                               readonly="readonly"></td>
                                    <td>
                                        <input style="width: 60px;" name="cfstudentname"
                                               value="${sharecarsubList.cfstudentname}" readonly="readonly">
                                        <input type="hidden" name="cfstudentid"
                                               value="${sharecarsubList.cfstudentid}">
                                    </td>
                                    <c:if test="${sharecarsubList.cfsex == 1}">
                                        <td><input style="width: 40px; text-align: center" value="男"></td>
                                    </c:if>
                                    <c:if test="${sharecarsubList.cfsex == 2}">
                                        <td><input style="width: 40px; text-align: center" value="女"></td>
                                    </c:if>
                                    <td><input style="width: 110px;" name="" value="${sharecarsubList.classname}"
                                               readonly="readonly">
                                        <input type="hidden" name="cfclazzid" value="${sharecarsubList.cfclazzid}"
                                               readonly="readonly">
                                    </td>
                                    <td><input style="width: 60px; text-align: center" name="cfsqzjcxdh"
                                               value="${sharecarsubList.cfsqzjcxdh}" readonly="readonly"></td>
                                    <input type="hidden" name="cfsqzjcxdh" value="${sharecarsubList.cfsqzjcxdh}">
                                    <td><input style="width: 160px; text-align: center" name="cfidcardno"
                                               value="${sharecarsubList.cfidcardno}" readonly="readonly"></td>
                                    <td><input style="width: 100px; text-align: center" name="cfmobile"
                                               value="${sharecarsubList.cfmobile}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cfamount"
                                               value="${sharecarsubList.cfamount}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cfreceived"
                                               value="${sharecarsubList.cfreceived}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cffavorable"
                                               value="${sharecarsubList.cffavorable}" readonly="readonly"></td>
                                    <td><input style="width: 60px; text-align: center" name="cfarrearage"
                                               value="${sharecarsubList.cfarrearage}" readonly="readonly"></td>
                                    <c:if test="${sharecarsubList.cfkscs ne 0}">
                                        <td><input style="width: 80px; text-align: center" value="初考"
                                                   readonly="readonly"></td>
                                    </c:if>
                                    <c:if test="${sharecarsubList.cfkscs eq 0}">
                                        <td><input style="width: 80px; text-align: center" value="补考"
                                                   readonly="readonly"></td>
                                    </c:if>
                                    <c:if test="${sharecarsubList.cfkscs eq null}">
                                        <td><input style="width: 80px; text-align: center" value="初考"
                                                   readonly="readonly"></td>
                                    </c:if>
                                    <input type="hidden" value="${sharecarsubList.cfkscs}" name="cfkscs">
                                    <td><input style="width: 70px; text-align: center" name=""
                                               value="${sharecarsubList.cfcoachname}" readonly="readonly"></td>
                                    <td><input style="width: 80px; text-align: center" value="无"></td>
                                    <td><input style="width: 70px; text-align: center" name=""
                                               value="${sharecarsubList.tlcs}" readonly="readonly"></td>
                                    <td><input style="width: 90px; text-align: center" name="cfkmekssj"
                                               value="${sharecarsubList.cfkmekssj}" readonly="readonly"></td>
                                    <td><input style="width: 90px; text-align: center" name="cfkmsbjksj"
                                               value="${sharecarsubList.cfkmsbjksj}" readonly="readonly"></td>
                                    <td><input style="width: 160px; text-align: center" name="cfremark"
                                               value="${sharecarsubList.cfremark}"><input
                                            type="hidden" name="states" value="2"></td>
                                </tr>
                            </c:forEach>

                        </table>
                    </div>

                    <input type="hidden" name="delFid" value="" id="delFid">
                </div>
                <div class="div_tj" style="padding-top: 0px">
                    <div>
                        <input class="input_submit qd" onclick="chcek()" value="" type="button">
                    </div>
                    <div>
                        <input type="button" onclick="location='<%=path%>/DrivingSys/practiseOrderAddList'"
                               class="input_back gb"
                               value=""/>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp" %>
<script type="text/javascript" src="<%=path%>/HoganJS/handlebars-v4.0.11.js"></script>
<script id="table-tr" type="text/x-handlebars-template">
    {{#each studentsNameList}}
    <tr class="tr_td">
        <td><input class='check2' type='checkbox' name='check2'
                   style='width:15px'><input name="check" type="hidden" value=""></td>
        <td><input style="width: 110px;" value="{{fnumber}}"
                   readonly="readonly"></td>
        <td>
            <input style="width: 60px;" name="cfstudentname"
                   value="{{fnameL2}}" readonly="readonly">
            <input type="hidden" name="cfstudentid"
                   value="{{fid}}">
        </td>
        {{#compare cfsex 1}}
        <td><input style="width: 40px; text-align: center" readonly="readonly" value="男"></td>
        {{/compare}}
        {{#compare cfsex 2}}
        <td><input style="width: 40px; text-align: center" readonly="readonly" value="女"></td>
        {{/compare}}

        <td><input style="width: 110px;" name="" value="{{cfclazzName}}" readonly="readonly">
            <input type="hidden" name="cfclazzid" value="{{cfclazzid}}">
        </td>

        <td><input style="width: 40px; text-align: center" name="cfsqzjcxdh" readonly="readonly" value="{{cfslzjcxdh}}">
        </td>
        <td><input style="width: 160px; text-align: center" name="cfidcardno" value="{{cfidcardno}}"
                   readonly="readonly"></td>
        <td><input style="width: 100px; text-align: center" name="cfmobile" value="{{cfsjhm}}" readonly="readonly"></td>
        <td><input style="width: 60px; text-align: center" name="cfamount" value="{{cfamount}}" readonly="readonly">
        </td>
        <td><input style="width: 60px; text-align: center" name="cfreceived" value="{{cfreceived}}" readonly="readonly">
        </td>
        <td><input style="width: 60px; text-align: center" name="cffavorable" value="{{cffavorable}}"
                   readonly="readonly"></td>
        <td><input style="width: 60px; text-align: center" name="cfarrearage" value="{{cfarrearage}}"
                   readonly="readonly"></td>
        {{#compare cfkmekss 0}}
        <td><input style="width: 80px; text-align: center" value="初考" readonly="readonly"></td>
        {{else}}
        <td><input style="width: 80px; text-align: center" value="补考" readonly="readonly"></td>
        {{/compare}}
        <input type="hidden" value="{{cfkmekss}}" name="cfkscs">
        <td><input style="width: 70px; text-align: center" name="" value="{{cfcoachname}}" readonly="readonly"></td>
        <td><input style="width: 80px; text-align: center" readonly="readonly" value="无"></td>
        <td><input style="width: 70px; text-align: center" name="" value="{{cfbimudf0060}}" readonly="readonly"></td>
        <td><input style="width: 90px; text-align: center" name="cfkmekssj" value="{{cfkmekssj}}" readonly="readonly">
        </td>
        <td><input style="width: 90px; text-align: center" name="cfkmsbjksj" value="{{cfkmebjgsj}}" readonly="readonly">
        </td>
        <td><input style="width: 160px; text-align: center" name="cfremark"
                   value="{{cfdesc}}"> <input type="hidden" name="states" value="1"></td>
        <input type="hidden" name="cfcoachname" value="{{jlname}}">
        <input type="hidden" name="cfcoachid" value="{{jlid}}">
    </tr>
    {{/each}}
</script>
<script id="table-tr2" type="text/x-handlebars-template">
    {{#each studentsNameList}}
    <tr class="tr_td">
        <td><input class='check2' type='checkbox' name='check2'
                   style='width:15px'><input name="check" type="hidden" value=""></td>
        <td><input style="width: 110px;" value="{{fnumber}}"
                   readonly="readonly"></td>
        <td>
            <input style="width: 60px;" name="cfstudentname" class="cfstudentname"
                   value="{{fnameL2}}" readonly="readonly">
            <input type="hidden" name="cfstudentid"
                   value="{{fid}}">
        </td>
        {{#compare cfsex 1}}
        <td><input style="width: 40px; text-align: center" readonly="readonly" value="男"></td>
        {{/compare}}
        {{#compare cfsex 2}}
        <td><input style="width: 40px; text-align: center" readonly="readonly" value="女"></td>
        {{/compare}}

        <td><input style="width: 110px;" name="" value="{{cfclazzName}}" readonly="readonly">
            <input type="hidden" name="cfclazzid" value="{{cfclazzid}}">
        </td>

        <td><input style="width: 40px; text-align: center" name="cfsqzjcxdh" readonly="readonly" value="{{cfslzjcxdh}}">
        </td>
        <td><input style="width: 160px; text-align: center" name="cfidcardno" value="{{cfidcardno}}"
                   readonly="readonly"></td>
        <td><input style="width: 100px; text-align: center" name="cfmobile" value="{{cfsjhm}}" readonly="readonly"></td>
        <td><input style="width: 60px; text-align: center" name="cfamount" value="{{cfamount}}" readonly="readonly">
        </td>
        <td><input style="width: 60px; text-align: center" name="cfreceived" value="{{cfreceived}}" readonly="readonly">
        </td>
        <td><input style="width: 60px; text-align: center" name="cffavorable" value="{{cffavorable}}"
                   readonly="readonly"></td>
        <td><input style="width: 60px; text-align: center" name="cfarrearage" value="{{cfarrearage}}"
                   readonly="readonly"></td>
        {{#compare cfkmskss 0}}
        <td><input style="width: 80px; text-align: center" value="{{cfkmskss}}" readonly="readonly"></td>
        {{else}}
        <td><input style="width: 80px; text-align: center" value="{{cfkmskss}}" readonly="readonly"></td>
        {{/compare}}
        <input type="hidden" value="{{cfkmekss}}" name="cfkscs">
        <td><input style="width: 70px; text-align: center" name="" value="{{cfcoachname}}" readonly="readonly"></td>
        <td><input style="width: 80px; text-align: center" value="无" readonly="readonly"></td>
        <td><input style="width: 70px; text-align: center" name="" value="{{cfbimudf0060}}" readonly="readonly"></td>
        <td><input style="width: 90px; text-align: center" name="cfkmekssj" value="{{cfkmekssj}}" readonly="readonly">
        </td>
        <td><input style="width: 90px; text-align: center" name="cfkmsbjksj" value="{{cfkmebjgsj}}" readonly="readonly">
        </td>
        <td><input style="width: 160px; text-align: center" name="cfremark"
                   value="{{cfdesc}}"> <input type="hidden" name="states" value="2"></td>
        <input type="hidden" name="cfcoachname" value="{{jlname}}">
        <input type="hidden" name="cfcoachid" value="{{jlid}}">
    </tr>
    {{/each}}
</script>
<script id="table-error" type="text/x-handlebars-template">
    <table class="error-list" style="width: auto;white-space:nowrap;border-spacing: 0px">
        <tr class="shuju">
            <td></td>
            <td>姓名</td>
            <td>身份证号码</td>
            <td>预约教练编号</td>
            <td>预约教练姓名</td>
            <td>备注</td>
            <td>原因</td>
        </tr>
        {{#each errorMsr}}
        <tr class="shuju">
            <td>{{addKey @index}}</td>
            <td>{{stuName}}</td>
            <td>{{cerno}}</td>
            <td>{{yyjlNo}}</td>
            <td>{{yyjlName}}</td>
            <td>{{bz}}</td>
            <td style="color: orangered">{{result}}</td>

        </tr>
        {{/each}}
    </table>
</script>
<script type="text/javascript">

    $(document).ready(function () {

        var User = function () {

            this.init = function () {
                $("#uploadEventBtn").live("click", function () {
                    $("#uploadEventFile").click();
                });

                $("#uploadEventFile").live("change", function () {
                    $("#uploadEventPath").attr("value", $("#uploadEventFile").val());
                    var uploadEventFile = $("#uploadEventFile").val();
                    if (confirm("是否把数据导入到练车预约")) {//弹出确认对话框
                        if (uploadEventFile.lastIndexOf(".xls") < 0) {//可判断以.xls和.xlsx结尾的excel
                            alert("只能上传Excel文件");
                            return false;
                        } else {

                            var url = '<%=path%>/DrivingSys/uploadPractiseOrderMass';
                            var formData = new FormData($('form')[1]);
                            var cfbilltype=${sharecarsubView.cfbilltype};
//                            var successTr=document.getElementById("succesStudnet");
                            var list=new Array();
                            /*$("#succesStudnet").find("tr").eq(1).find("td").eq(2).children("input").each(function () {
                                list.push($(this).val());
                            })*/

                            $("#succesStudnet").find("tr").each(function(){
                                var tdArr = $(this).children();
//                                var history_income_type = tdArr.eq(0).find('input').val();//收入类别
//                                var history_income_money = tdArr.eq(1).find('input').val();//收入金额
                                var studentName = tdArr.eq(2).find('input').val();// 备注
                                if(studentName!=null&&studentName!=""){
                                    list.push(studentName);
                                }
                            });

//                            $("#succesStudnet tr:gt(0) td:eq(2) input").each(function (index, element) {
//                                console.log(element.val());
//                                list.push($(this).val());
//                            })
//                            $("#succesStudnet > td").each();
//                            var rows = successTr.rows;
////                            alert(successTr.length+"");
//                            if(rows.length>0){
//
//                            for(var i=0;i<rows.length;i++)//循环遍历所有的tr行
//                            {
//                                    var cell = rows[i].cells[2];//获取某行下面的某个td元素
//                                    list[i]=cell.innerHTML;
//                            }
//                           }else{
//                                alert("当前页面没有导入成功的数据")
//                            }

                            formData.append("cfbilltype",cfbilltype+"");
                            formData.append("studentName",list);

                            user.sendAjaxRequest(url, 'POST', formData);
                        }
                        var file = document.getElementById('uploadEventFile');
                        file.value = ''; //虽然file的value不能设为有字符的值，但是可以设置为空值
                        return true;    //点击确定时，返回值为true，执行如上操作。

                    } else {
                        var file = document.getElementById('uploadEventFile');
                        file.value = ''; //虽然file的value不能设为有字符的值，但是可以设置为空值
                        return false; //点击取消时，返回值为false，不执行操作。
                    }

                });

            }
            this.sendAjaxRequest = function (url, type, data) {
                $.ajax({
                    url: url,
                    type: type,
                    data: data,
                    dataType: "json",
                    success: function (res) {
                        var tem = $('.tablelist').html()
                        var students = "";
                        var count =0;//计数
                        var item = new Array();//记录重复学员对象的下标
                        for(var j=0;j<res.studentsNameList.length;j++){

                            $(".tr_td input[name=cfstudentname]").each(function(i) {

                                if ($(this).val() == res.studentsNameList[j].fnameL2) {
                                    item.push(j)
                                    var name = $(this).val();
                                    if (count == 0) {
                                        students = name;
                                    } else {
                                        students += "," + name;
                                    }
                                    count++;
                                }
                            })
                        }
                        if(students != ''){
//                            for (var k = 0;k<item.length;k++){
//
//                                delete (res.studensNamelist[item[k]]);//删除重复的学员对象
//                            }
                            alert(students+" 已经在列表中!")
                            return false;
                        }
                        $('.tablelist').html(tem + myTemplatetr(res));
                        if (res.errorMsr != null) {
                            $('#error').html(myTemplatetrerror(res));
                            $('#modal-overlay').css('visibility', 'visible')
                            $('.modal-data-error').css('visibility', 'visible')
                        }
                        if(res==null){
                            alert("导入数据为空")
                        }
                    },
                    error: function () {
                        alert("excel上传失败");
                    },
                    cache: false,
                    contentType: false,
                    processData: false
                });
            };


        }

        var user;
        $(function () {
            user = new User();
            user.init();
        });
    })

    $('#exportExcle').live('click', function () {
        location.href = '<%=path%>/DrivingSys/exportPractiseOrderMassExcle'
    })

    var state = "";

    //弹出框模版文件//预约成功
    var myTemplatetr = Handlebars.compile($("#table-tr").html());
    //预约失败
    var myTemplatetr2 = Handlebars.compile($("#table-tr2").html());
    // 错误页面
    var myTemplatetrerror = Handlebars.compile($("#table-error").html());
    //注册一个比较内容是否为空
    Handlebars.registerHelper("isNull", function (v1, options) {
        if (v1 != "") {
            //满足添加继续执行
            return options.fn(this);
        } else {
            //不满足条件执行{{else}}部分
            return options.inverse(this);
        }
    });

    //注册一个比较大小的Helper,判断v1是否大于v2
    Handlebars.registerHelper("compare", function (v1, v2, options) {
        if (v2 == 100) {
            //满足添加继续执行
            return options.fn(this);
        }
        if (v1 == v2) {
            //满足添加继续执行
            return options.fn(this);
        }
        else if (v1 == null) {
            //满足添加继续执行
            return options.fn(this);
        } else {
            //不满足条件执行{{else}}部分
            return options.inverse(this);
        }
    });
    Handlebars.registerHelper('addKey', function (index) {
        return index + 1;
    });

    $('.order').click(function () {
        $('.order').removeClass('active')
        $(this).addClass('active')
        if ($(this).html() == '预约成功') {
            $('.success').show()
            $('.fail').hide()
        } else {
            $('.success').hide()
            $('.fail').show()
        }
    })

    //弹出模式框学生信息
    function clickName(e, state) {
        $('#modal-overlay').css('visibility', 'visible')
        $('.modal-data').css('visibility', 'visible')
        $('.data-checkbox:checkbox').removeAttr('checked');
        $('.page').show();
        cfbilltype = $('.cfbilltype').val()
        myname = $('.name1').val();
        cflxdh = $('.cflxdh').val();
        var index = 0;
        $('#flag').val(state)
        $('#studebntList').html("<div class='loading'></div>");
        $.ajax({
            url: '<%=path2%>/DrivingSys/getPageEnrol',
            type: "post",
            data: {
                'pindex': '0',
                'name': myname,
                'cfsjhm': cflxdh,
                'beginTime': beginTime.val(),
                'endTime': endTime.val(),
                'state': cfbilltype
            },
            dataType: "json",
            success: function (res) {
                $('#studebntList').html(myTemplate(res));
                $('#totalPage').val(res.pb);
            },
            error: function () {
                alert('Error');
            }
        });
        _this = e.parent().parent();
    }

    //把选中的学生信息名称填充到输入框中
    $('.subtn').click(function () {
        var spCodesTemp = "";
        $('input:checkbox[name=student]:checked').each(function (i) {
            if (0 == i) {
                //把学生id增加到字表中
                spCodesTemp = $(this).val();

            } else {
                spCodesTemp += ("," + $(this).val());

            }
        });

        $.ajax({
            url: '<%=path%>/DrivingSys/selStudentsByFid',
            type: "post",
            data: {'id': spCodesTemp},
            dataType: "json",
            success: function (res) {
                if ($('#flag').val() == 1) {
                    var tem = $('.tablelist').html()
                    $('.tablelist').html(tem + myTemplatetr(res));
                    $('#modal-overlay').css('visibility', 'hidden')
                    $('.modal-data').css('visibility', 'hidden')
                    $('.order')[0].click();
                }
                if ($('#flag').val() == 2) {
                    var tem = $('.table1').html()
                    $('.table1').html(tem + myTemplatetr2(res));
                    $('#modal-overlay').css('visibility', 'hidden')
                    $('.modal-data').css('visibility', 'hidden')
                    $('.order')[1].click();
                }
            },
            error: function () {
                alert('Error');
            }
        });

    });

    //取消
    $('.btn').click(function () {
        $('#modal-overlay').css('visibility', 'hidden')
        //$('.modal-data').css('visibility','hidden')
        $('.modal-data1').css('visibility', 'hidden')
        $('.modal-data2').css('visibility', 'hidden')
        $('.modal-data').css('visibility', 'hidden')
        $('.modal-data-error').css('visibility', 'hidden')

        $('input:checkbox').removeAttr('checked');
    })

    //选中的删除
    $(".deleteTable").click(function () {
        var tr_len = $("#table1 tr").length;
        var s = '';
        $('input:checkbox[name=check2]').each(function (i) {

            if ($(this).is('.check2:checked')) {

                $('#delFid').val($('#delFid').val() + "," + $(this).next().val());
                $(this).parent().parent().remove();
                s = '1';
                reorder()
            }
        })

        //判断是否选中
        if (s == null || s == '') {
            alert("请选择一条数据删除");
            return false;
        }
    })


    //改变复选框的值
    function chcek() {

        $('#update_shar').submit()

    }

    /* //查询详情
     $(".tablelist tr").dblclick(function () {
         var fid2 = $(this).find("input[name=check]").val();
         //避免fid中有+，或者特殊字符
         var fid = encodeURI(fid2).replace(/\+/g, '%2B')
         location = "go_update_Sharecarsubentry?state=1&fid=" + fid;
     })*/

</script>
</html>